﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SocialLearning
{
    public partial class CutomMessageForm : Form
    {
        #region Fields

        private int user;
        private string option;
        private MainForm mainform;

        #endregion

        #region Constructor

        internal CutomMessageForm(int user, MainForm mForm, string option)
        {
            this.user = user;
            this.mainform = mForm;
            this.option = option;
            InitializeComponent();
        }

        #endregion

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnUpdate_Click(object sender, EventArgs e)
        {
            this.Hide();
            using (UserUpdateForm userupdateForm = new UserUpdateForm(UAC_UserManagement.userlist[user]) { Text = "update", AutoScroll = true, StartPosition = FormStartPosition.CenterScreen, ControlBox = false })
            {
                userupdateForm.ShowDialog();
            }
            this.Close();
        }

        private void btnGroups_Click(object sender, EventArgs e)
        {
            List<string> groups =
                UAC_GroupManagement.Instance.SearchGroupMember(
                    UAC_UserManagement.userlist[user].BasicAccountDetails.ID);

            mainform.LoadGroup(groups);
            this.Close();
        }
    }
}
